package com.wanmait.schedule.controller;

import com.auth0.jwt.exceptions.JWTVerificationException;
import com.wanmait.schedule.util.AjaxResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice//@ControllerAdvice+@ResponseBody
public class CommonControllerAdvice {

    //可以使用枚举，定义10001表示登录失败，10002表示token认证失败
    @ExceptionHandler(JWTVerificationException.class)
    public AjaxResult processJWTVerificationException(JWTVerificationException e){
        return AjaxResult.error(10002,e.getMessage());
    }
}
